package org.example.producer.controller;

import lombok.AllArgsConstructor;
import org.example.common.model.vo.base.ResponseVO;
import org.example.common.util.ResponseUtils;
import org.example.producer.domain.UserDTO;
import org.example.producer.holder.LoginUserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 获取登录用户信息接口
 *
 * @author lsliang
 */
@RestController
@RequestMapping("/api/user")
@AllArgsConstructor
public class UserController {

    private final LoginUserHolder loginUserHolder;

    @GetMapping("/currentUser")
    public ResponseVO<UserDTO> currentUser() {
        return ResponseUtils.success(loginUserHolder.getCurrentUser());
    }

}
